package fileread;

import java.util.regex.*;
public class PatternCount {
   public static void main(String[] args) {
      String s = "#!123#!4567#!8910";
      Pattern p = Pattern.compile("#!"); 

      Matcher m = p.matcher(s);
      int count = 0;
      for( int i = 0; m.find(i); i = m.end())
      count++;

      System.out.println(count); //특정문자열(Pattern)의 갯수
   }
};  

